#define _CRT_SECURE_NO_WARNINGS 
#include<stdio.h>
void Read(int arr[], int n)
{
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }
}
void Sort(int a[],int n, int b[], int m, int c[])
{
    for (int i = 0; i < n; i++)
    {
        c[i] = a[i];
    }
    for (int j = 0; j < m; j++)
    {
        c[j + n - 1] = b[j];
    }
}
int main()
{
    int a[] = { 0 };
    int c[] = { 0 };
    int b[] = { 0 };
    int n = 0;
    int m = 0;
    scanf("%d%d", &n, &m);
    Read(a, n);
    Read(b, m);
    Sort(a, n, b, m, c);

    return 0;
}